package org.dfl.taverna;

import org.dfl.plugin.DflProcessorHelper;
import org.eclipse.jface.resource.ImageDescriptor;
import org.embl.ebi.escience.scuflworkers.ProcessorFactory;
import org.embl.ebi.escience.scuflworkers.ProcessorHelper;

/**
 *
 * @author Lukas
 */
public class TavernaProcessor {

    private ProcessorFactory factory;
    private String label;
    private String description;
    private String tagName;

    private static String stripTags(String str) {
        return str.replaceAll("<[^>]*>", "");
    }

    public TavernaProcessor(ProcessorFactory factory) {
        this.factory = factory;
        label = stripTags(factory.getName());
        description = stripTags(factory.getProcessorDescription());
        tagName = ProcessorHelper.getTagNameForClassName(factory.getProcessorClass().getName());
    }
    
    public String getLabel() {
        return label;
    }

    public String getDescription() {
        return description;
    }
    
    public ProcessorFactory getFactory() {
    	return factory;
    }

    public ImageDescriptor getIcon() {
        return DflProcessorHelper.getIconForTagName(tagName);
    }
}
